package com.book.dao;

import com.book.entity.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentMapper {

    @Select("select * from student")
    List<Student> getStudentList();

    @Insert("insert into student(name,sex,grade) values(#{name},#{sex},#{grade})")
    int addStudent(@Param("name")String name,@Param("sex")String sex,@Param("grade")String grade);

    @Delete("delete from student where sid=#{sid}")
    int deleteStudentBySid(@Param("sid") int sid);

    @Select("select * from student where name like concat('%',#{msg},'%')")
    List<Student> getStudentListLike(String msg);

    @Update("update student set name=#{name},sex=#{sex},grade=#{grade} where sid=#{sid}")
    int updateStudent(Student student);
}
